﻿using DDLParser.constant;
using DDLParser.model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DDLParser.sqlserver
{
    class SqlServerTypeLookup: DDLTermLookup
    {
        public SqlServerTypeLookup()
            : base()
        {
            // must sort!!!!
            List<DDLTerm> termList = new List<DDLTerm>();
            termList.Add(new DDLTerm() { Term = SqlServerData.INT, Type = SqlServerDataType.INT });
            termList.Add(new DDLTerm() { Term = SqlServerData.REAL, Type = SqlServerDataType.REAL });
            termList.Add(new DDLTerm() { Term = SqlServerData.DECIMAL, Type = SqlServerDataType.DECIMAL });
            termList.Add(new DDLTerm() { Term = SqlServerData.FLOAT, Type = SqlServerDataType.FLOAT });
            termList.Add(new DDLTerm() { Term = SqlServerData.NUMERIC, Type = SqlServerDataType.NUMERIC });
            termList.Add(new DDLTerm() { Term = SqlServerData.MONEY, Type = SqlServerDataType.MONEY });
            termList.Add(new DDLTerm() { Term = SqlServerData.SMALLMONEY, Type = SqlServerDataType.SMALLMONEY });
            termList.Add(new DDLTerm() { Term = SqlServerData.CHAR, Type = SqlServerDataType.CHAR });
            termList.Add(new DDLTerm() { Term = SqlServerData.TEXT, Type = SqlServerDataType.TEXT });
            termList.Add(new DDLTerm() { Term = SqlServerData.NCHAR, Type = SqlServerDataType.NCHAR });
            termList.Add(new DDLTerm() { Term = SqlServerData.NTEXT, Type = SqlServerDataType.NTEXT });
            termList.Add(new DDLTerm() { Term = SqlServerData.VARCHAR, Type = SqlServerDataType.VARCHAR });
            termList.Add(new DDLTerm() { Term = SqlServerData.NVARCHAR, Type = SqlServerDataType.NVARCHAR });
            termList.Add(new DDLTerm() { Term = SqlServerData.STRING, Type = SqlServerDataType.STRING });
            termList.Add(new DDLTerm() { Term = SqlServerData.DATE, Type = SqlServerDataType.DATE });
            termList.Add(new DDLTerm() { Term = SqlServerData.DATETIME, Type = SqlServerDataType.DATETIME });
            termList.Add(new DDLTerm() { Term = SqlServerData.SMALLDATETIME, Type = SqlServerDataType.SMALLDATETIME });
            termList.Add(new DDLTerm() { Term = SqlServerData.DATETIMEOFFSET, Type = SqlServerDataType.DATETIMEOFFSET });
            termList.Add(new DDLTerm() { Term = SqlServerData.TIME, Type = SqlServerDataType.TIME });
            termList.Add(new DDLTerm() { Term = SqlServerData.TIMESTAMP, Type = SqlServerDataType.TIMESTAMP });
            termList.Add(new DDLTerm() { Term = SqlServerData.IMAGE, Type = SqlServerDataType.IMAGE });
            termList.Add(new DDLTerm() { Term = SqlServerData.GEOGRAPHY, Type = SqlServerDataType.GEOGRAPHY });
            termList.Add(new DDLTerm() { Term = SqlServerData.GEOMETRY, Type = SqlServerDataType.GEOMETRY });
            termList.Add(new DDLTerm() { Term = SqlServerData.HIERARCHYID, Type = SqlServerDataType.HIERARCHYID });
            termList.Add(new DDLTerm() { Term = SqlServerData.BIGINT, Type = SqlServerDataType.BIGINT });
            termList.Add(new DDLTerm() { Term = SqlServerData.SMALLINT, Type = SqlServerDataType.SMALLINT });
            termList.Add(new DDLTerm() { Term = SqlServerData.TINYINT, Type = SqlServerDataType.TINYINT });
            termList.Add(new DDLTerm() { Term = SqlServerData.BOOLEAN, Type = SqlServerDataType.BOOLEAN });
            termList.Add(new DDLTerm() { Term = SqlServerData.BIT, Type = SqlServerDataType.BIT });
            termList.Add(new DDLTerm() { Term = SqlServerData.BINARY, Type = SqlServerDataType.BINARY });
            termList.Add(new DDLTerm() { Term = SqlServerData.VARBINARY, Type = SqlServerDataType.VARBINARY });
            termList.Add(new DDLTerm() { Term = SqlServerData.UNIQUEIDENTIFIER, Type = SqlServerDataType.UNIQUEIDENTIFIER });
            termList.Add(new DDLTerm() { Term = SqlServerData.SQLVARIANT, Type = SqlServerDataType.SQLVARIANT });
            termList.Add(new DDLTerm() { Term = SqlServerData.XML, Type = SqlServerDataType.XML });


            //TermComparator comparator = new TermComparator();
            //termList.Sort(comparator);
            SetTermList(termList);

            Sort();

            IsConvertUpperCase = false;
        }
    }
}
